from django.urls import path, include
from rest_framework.routers import DefaultRouter  # 导入路由器
from snippets import views

# 创建路由器并用它注册我们的视图集。
router = DefaultRouter()
router.register(r'snippets', views.SnippetViewSet, basename="snippet")
router.register(r'users', views.UserViewSet, basename="user")

# 现在由路由器自动确定API URL。
urlpatterns = [
    path('', include(router.urls)),
]
